package Lotr.game;

import Lotr.game.Entity.Enemies;
import Lotr.game.Entity.Enemy;
import java.awt.Color;
import java.awt.Graphics;

public class Level {

    private Enemies enemies;
    private Path path;
    private int width, height;
    private GameManager gameManager;
    
    public Level(int width, int height, Resources res, GameManager gameManager){
        this.width = width;
        this.height = height;
        this.gameManager = gameManager;
        enemies = new Enemies(res);
        path = new Path(this);
        enemies.addEnemy(Enemy.TROLL, path);
        //enemies.addEnemy(Enemy.ORK, path);
        //enemies.addEnemy(Enemy.WARG, path);
        //enemies.addEnemy(Enemy.URUK, path);
    }
    
    public void update(){
        enemies.update();
    }
    
    public void render(Graphics g){
        renderBackground(g);
        enemies.render(g);
    }
    
    private void renderBackground(Graphics g){
        g.setColor(Color.cyan);
        g.fillRect(0, 0, width, height);
        path.render(g);
    }

    public void enemyReachedEnd(Enemy e, int damage) {
        gameManager.getPlayer().damage(damage);
        //enemies.removeEnemy(e);
        //enemies.addEnemy(Enemy.TROLL, path);
    }
}
